package com.mer.config;


import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

@Controller
@EnableSwagger2
public class MyConfiguration {

    @Bean
    public Docket getDocket(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .groupName("qy137")
                .apiInfo(apiInfo())
                .select()
                .paths(Predicates.not(PathSelectors.regex("/error.*")))
                .build()
                ;
        return docket;
    }

    public ApiInfo apiInfo(){
        Contact DEFAULT_CONTACT = new Contact("张庆恒", "www.baidu.com", "136486120@qq.com");
        ApiInfo DEFAULT = new ApiInfo("在线教育平台", "在线教育平台", "4.1", "www.136486120@qq.com",
                DEFAULT_CONTACT, "Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0", new ArrayList<VendorExtension>());
        return DEFAULT;
    }

}
